package com.csdj.t309springboot.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * <p>
 * 积分记录表 Integral record
 * </p>
 *
 * @author 谭湛宇
 * @since 2022-01-13
 */
@TableName("integral_record")
public class IntegralRecord implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 积分编号
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 用户编号
     */
    private Integer userId;
    /**
     * 积分来源/操作类型
     */
    private String integralSource;

    /**
     * 积分数量
     */
    private Integer integralNumber;
    /**
     * 积分余额
     */
    private Integer integralBalance;
    /**
     * 积分变化,例子:+100,-100
     */
    private Integer integralChange;

    /**
     * 已经使用的积分数量
     */
    private Integer used;

    /**
     * 一对一映射
     */
//    private User user;
    /**
     * 操作时间
     */
    //转换日期格式
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime modifyTime;
    /**
     * 积分截止日期
     */
    private LocalDate expire;

    public LocalDateTime getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(LocalDateTime modifyTime) {
        this.modifyTime = modifyTime;
    }

    public Integer getIntegralBalance() {
        return integralBalance;
    }

    public void setIntegralBalance(Integer integralBalance) {
        this.integralBalance = integralBalance;
    }

    public String getIntegralSource() {
        return integralSource;
    }

    public void setIntegralSource(String integralSource) {
        this.integralSource = integralSource;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }
    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }
    public Integer getIntegralNumber() {
        return integralNumber;
    }

    public void setIntegralNumber(Integer integralNumber) {
        this.integralNumber = integralNumber;
    }
    public Integer getIntegralChange() {
        return integralChange;
    }

    public void setIntegralChange(Integer integralChange) {
        this.integralChange = integralChange;
    }
    public Integer getUsed() {
        return used;
    }

    public void setUsed(Integer used) {
        this.used = used;
    }
    public LocalDate getExpire() {
        return expire;
    }

    public void setExpire(LocalDate expire) {
        this.expire = expire;
    }

    @Override
    public String toString() {
        return "IntegralRecord{" +
            "id=" + id +
            ", userId=" + userId +
            ", integralNumber=" + integralNumber +
            ", integralChange=" + integralChange +
            ", used=" + used +
            ", expire=" + expire +
        "}";
    }
}
